import {get_Userinfo,get_Token,get_TokenML} from '@/utils/auth.js'
const state = {
	wl_token      :get_TokenML(),
	sys_token     :get_Token(),
	userInfo      :get_Userinfo(),
	birthday      :(get_Userinfo() == null) ? "": get_Userinfo().birthday,
	cityName      :(get_Userinfo() == null) ? "": get_Userinfo().cityName,
	comAddress    :(get_Userinfo() == null) ? "": get_Userinfo().comAddress,
	countiesName  :(get_Userinfo() == null) ? "": get_Userinfo().countiesName,
	departMentId  :(get_Userinfo() == null) ? "": get_Userinfo().departMentId ,
	disenable     :(get_Userinfo() == null) ? "": get_Userinfo().disenable,
	dtlAddress    :(get_Userinfo() == null) ? "": get_Userinfo().dtlAddress,
	email         :(get_Userinfo() == null) ? "": get_Userinfo().email,
	englishName   :(get_Userinfo() == null) ? "": get_Userinfo().englishName,
	entryDate     :(get_Userinfo() == null) ? "": get_Userinfo().entryDate,
	headFilePath  :(get_Userinfo() == null) ? "": get_Userinfo().headFilePath,
	homeTel       :(get_Userinfo() == null) ? "": get_Userinfo().homeTel,
	id            :(get_Userinfo() == null) ? "": get_Userinfo().id,
	ismanager     :(get_Userinfo() == null) ? "": get_Userinfo().ismanager,
	mobile        :(get_Userinfo() == null) ? "": get_Userinfo().mobile,
	nationName    :(get_Userinfo() == null) ? "": get_Userinfo().nationName,
	nativeName    :(get_Userinfo() == null) ? "": get_Userinfo().nativeName,
	officeFax     :(get_Userinfo() == null) ? "": get_Userinfo().officeFax,
	officeTel     :(get_Userinfo() == null) ? "": get_Userinfo().officeTel,
	onlines       :(get_Userinfo() == null) ? "": get_Userinfo().onlines,
	orderIndex    :(get_Userinfo() == null) ? "": get_Userinfo().orderIndex,
	passWords     :(get_Userinfo() == null) ? "": get_Userinfo().passWords,
	phoneCornet   :(get_Userinfo() == null) ? "": get_Userinfo().phoneCornet,
	politicalface :(get_Userinfo() == null) ? "": get_Userinfo().politicalface,
	positionName  :(get_Userinfo() == null) ? "": get_Userinfo().positionName,
	postName      :(get_Userinfo() == null) ? "": get_Userinfo().postName,
	provinceName	:(get_Userinfo() == null) ? "": get_Userinfo().provinceName,
	remark	      :(get_Userinfo() == null) ? "": get_Userinfo().remark,
	sex           :(get_Userinfo() == null) ? "": get_Userinfo().sex,
	userAlias     :(get_Userinfo() == null) ? "": get_Userinfo().userAlias,
	userId        :(get_Userinfo() == null) ? "": get_Userinfo().userId,
	userName      :(get_Userinfo() == null) ? "": get_Userinfo().userName,
	userType      :(get_Userinfo() == null) ? "": get_Userinfo().userType,
	workState     :(get_Userinfo() == null) ? "": get_Userinfo().workState
}
const actions = {
	setToken:({commit},params)=>{
		 commit("SET_TOKEN",params);
	},
	setUserinfo:({commit},params)=>{
		commit("SETUSERINFO",params);
	},
	setTokenWL:({commit},params)=>{
		 commit("SET_TOKEN_WL",params);
	}
}
const mutations={
  SET_TOKEN:(state,data)=>{
   	 state.sys_token = data
  },
  SET_TOKEN_WL:(state,data)=>{
	state.wl_token = data
  },
	SETUSERINFO:(state,data)=>{
		 state.userInfo = data,
		 state.birthday =data.birthday,
		 state.cityName =data.cityName,
		 state.comAddress =data.comAddress,
		 state.countiesName =data.countiesName,
		 state.departMentId =data.departMentId,
		 state.disenable =data.disenable,
		 state.dtlAddress =data.dtlAddress,
		 state.email =data.email,
		 state.englishName =data.englishName,
		 state.entryDate =data.entryDate,
		 state.headFilePath =data.headFilePath,
		 state.homeTel =data.homeTel,
		 state.id =data.id,
		 state.ismanager =data.ismanager,
		 state.mobile =data.mobile,
		 state.nationName =data.nationName,
		 state.nativeName =data.nativeName,
		 state.officeFax =data.officeFax,
		 state.officeTel =data.officeTel,
		 state.onlines =data.onlines,
		 state.orderIndex =data.orderIndex,
		 state.passWords =data.passWords,
		 state.phoneCornet =data.phoneCornet,
		 state.politicalface =data.politicalface,
		 state.positionName =data.positionName,
		 state.postName =data.postName,
		 state.provinceName	=data.provinceName,
		 state.remark	=data.remark,
		 state.sex =data.sex,
		 state.userAlias =data.userAlias,
		 state.userId =data.userId,
		 state.userName =data.userName,
		 state.userType	=data.userType,
		 state.workState =data.workState
	}
}
const getters ={
	wl_token     :state=>state.wl_token,
	birthday     :state=>state.birthday,
	cityName     :state=> state.cityName,
	comAddress   :state=>state.comAddress,
	countiesName :state=>state.countiesName,
	departMentId :state=>state.departMentId ,
	disenable    :state=>state.disenable,
	dtlAddress   :state=>state.dtlAddress,
	email        :state=>state.email,
	englishName  :state=>state.englishName,
	entryDate    :state=>state.entryDate,
	headFilePath :state=>state.headFilePath,
	homeTel      :state=>state.homeTel,
	id           :state=>state.id,
	ismanager    :state=>state.ismanager,
	mobile       :state=>state.mobile,
	nationName   :state=>state.nationName,
	nativeName   :state=>state.nativeName,
	officeFax    :state=>state.officeFax,
	officeTel    :state=>state.officeTel,
	onlines      :state=>state.onlines,
	orderIndex   :state=>state.orderIndex,
	passWords    :state=>state.passWords,
	phoneCornet  :state=>state.phoneCornet,
	politicalface:state=>state.politicalface,
	positionName :state=>state.positionName,
	postName     :state=>state.postName,
	provinceName :state=>state.provinceName,
	remark       :state=>state.remark,
	sex          :state=>state.sex,
	userAlias    :state=>state.userAlias,
	userId       :state=>state.userId,
	userName     :state=>state.userName,
	userType     :state=>state.userType,
	workState    :state=>state.workState
}
export default{
	state,
	actions,
	mutations,
	getters
}
